home *** CD-ROM | disk | FTP | other *** search
/ Vypalování CD / Vypalovani-CD-cd1.bin / CDWriter ActiveX Control 1.4 / CDWriterXP.exe / {app} / Sample1 / frmDiscInfo.frm (.txt) next >
Visual Basic Form  |  2001-10-09  |  10KB  |  281 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDiscInfo 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Disc Info"
  5.    ClientHeight    =   3720
  6.    ClientLeft      =   2760
  7.    ClientTop       =   3750
  8.    ClientWidth     =   4620
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3720
  13.    ScaleWidth      =   4620
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.Frame fraInfo 
  17.       Height          =   2010
  18.       Left            =   255
  19.       TabIndex        =   3
  20.       Top             =   135
  21.       Width           =   4170
  22.       Begin VB.Label lblValueDiscStatus 
  23.          Caption         =   "N/A"
  24.          Height          =   240
  25.          Left            =   1980
  26.          TabIndex        =   13
  27.          Top             =   1290
  28.          Width           =   2010
  29.       End
  30.       Begin VB.Label lblDiscStatus 
  31.          Caption         =   "Disc Status:"
  32.          Height          =   240
  33.          Left            =   330
  34.          TabIndex        =   12
  35.          Top             =   1290
  36.          Width           =   1470
  37.       End
  38.       Begin VB.Label lblValueFreeSpaceBlocks 
  39.          Caption         =   "N/A"
  40.          Height          =   240
  41.          Left            =   1980
  42.          TabIndex        =   11
  43.          Top             =   1605
  44.          Width           =   2010
  45.       End
  46.       Begin VB.Label lblFreeSpace 
  47.          Caption         =   "Free Space Blocks:"
  48.          Height          =   240
  49.          Left            =   330
  50.          TabIndex        =   10
  51.          Top             =   1605
  52.          Width           =   1470
  53.       End
  54.       Begin VB.Label lblValueDiscType 
  55.          Caption         =   "N/A"
  56.          Height          =   240
  57.          Left            =   1980
  58.          TabIndex        =   9
  59.          Top             =   975
  60.          Width           =   2010
  61.       End
  62.       Begin VB.Label lblDiscType 
  63.          Caption         =   "Disc Type:"
  64.          Height          =   240
  65.          Left            =   330
  66.          TabIndex        =   8
  67.          Top             =   975
  68.          Width           =   1470
  69.       End
  70.       Begin VB.Label lblValueLastSessionStatus 
  71.          Caption         =   "N/A"
  72.          Height          =   240
  73.          Left            =   1980
  74.          TabIndex        =   7
  75.          Top             =   660
  76.          Width           =   2010
  77.       End
  78.       Begin VB.Label lblSessionStatus 
  79.          Caption         =   "Last Session Status:"
  80.          Height          =   240
  81.          Left            =   330
  82.          TabIndex        =   6
  83.          Top             =   660
  84.          Width           =   1470
  85.       End
  86.       Begin VB.Label lblValueSessions 
  87.          Caption         =   "N/A"
  88.          Height          =   240
  89.          Left            =   1980
  90.          TabIndex        =   5
  91.          Top             =   345
  92.          Width           =   2010
  93.       End
  94.       Begin VB.Label lblSessions 
  95.          Caption         =   "Number of Sessions:"
  96.          Height          =   240
  97.          Left            =   330
  98.          TabIndex        =   4
  99.          Top             =   345
  100.          Width           =   1470
  101.       End
  102.    End
  103.    Begin VB.CommandButton cmdCloseDisc 
  104.       Caption         =   "Close Disc"
  105.       Height          =   375
  106.       Left            =   1755
  107.       TabIndex        =   2
  108.       Top             =   2640
  109.       Width           =   1395
  110.    End
  111.    Begin VB.CommandButton cmdCloseSession 
  112.       Caption         =   "Close Session"
  113.       Height          =   375
  114.       Left            =   300
  115.       TabIndex        =   1
  116.       Top             =   2640
  117.       Width           =   1395
  118.    End
  119.    Begin VB.CommandButton cmdOK 
  120.       Caption         =   "OK"
  121.       Height          =   375
  122.       Left            =   3660
  123.       TabIndex        =   0
  124.       Top             =   2640
  125.       Width           =   780
  126.    End
  127.    Begin VB.Label lblStatus 
  128.       Alignment       =   2  'Center
  129.       BeginProperty Font 
  130.          Name            =   "MS Sans Serif"
  131.          Size            =   8.25
  132.          Charset         =   0
  133.          Weight          =   700
  134.          Underline       =   0   'False
  135.          Italic          =   0   'False
  136.          Strikethrough   =   0   'False
  137.       EndProperty
  138.       Height          =   225
  139.       Left            =   720
  140.       TabIndex        =   14
  141.       Top             =   2205
  142.       Width           =   3165
  143.    End
  144. Attribute VB_Name = "frmDiscInfo"
  145. Attribute VB_GlobalNameSpace = False
  146. Attribute VB_Creatable = False
  147. Attribute VB_PredeclaredId = True
  148. Attribute VB_Exposed = False
  149. Option Explicit
  150. Private WithEvents mobjCDR As CDWriterXP
  151. Attribute mobjCDR.VB_VarHelpID = -1
  152. Private mblnClosing As Boolean
  153. '****************************************************************
  154. '****************************************************************
  155. 'COPYRIGHT 2001 NUGROOVZ
  156. 'This is a sample of how you could use the CDWriterXP control.
  157. 'There are improvements which could be made rather easily.
  158. 'Feel free to modify it as you see fit.
  159. '****************************************************************
  160. '****************************************************************
  161. Private Sub cmdCloseDisc_Click()
  162.     mblnClosing = True
  163.     cmdOK.Enabled = False
  164.     cmdCloseDisc.Enabled = False
  165.     cmdCloseSession.Enabled = False
  166.     'Call close last session method
  167.     If mobjCDR.CloseLastSession(True) = False Then
  168.         MsgBox "Error attempting to Close Disc!", vbCritical, App.Title
  169.         mblnClosing = False
  170.         cmdOK.Enabled = True
  171.         cmdCloseDisc.Enabled = True
  172.         cmdCloseSession.Enabled = True
  173.     End If
  174.     'Events will tell us if it succeeded or not
  175. End Sub
  176. Private Sub cmdCloseSession_Click()
  177.     mblnClosing = True
  178.     cmdOK.Enabled = False
  179.     cmdCloseDisc.Enabled = False
  180.     cmdCloseSession.Enabled = False
  181.     'Call close last session method
  182.     If mobjCDR.CloseLastSession(False) = False Then
  183.         MsgBox "Error attempting to Close Session!", vbCritical, App.Title
  184.         mblnClosing = False
  185.         cmdOK.Enabled = True
  186.         cmdCloseDisc.Enabled = True
  187.         cmdCloseSession.Enabled = True
  188.     End If
  189.     'Events will tell us if it succeeded or not
  190. End Sub
  191. Private Sub cmdOK_Click()
  192.      Unload Me
  193. End Sub
  194. Private Sub Form_Unload(Cancel As Integer)
  195.     If mblnClosing = True Then
  196.         Cancel = 1
  197.         Exit Sub
  198.     End If
  199.     'Set instance to nothing
  200.     Set mobjCDR = Nothing
  201. End Sub
  202. Public Sub ShowDiscInfo(objCDR As CDWriterXP, frmParent As Form)
  203.     'Set local object
  204.     Set mobjCDR = objCDR
  205.     'Check for media
  206.     If mobjCDR.IsMediaLoaded() = False Then
  207.         MsgBox "No Media Loaded...Cannot Get Disc Info!", vbOKOnly + vbInformation, App.Title
  208.         Unload Me
  209.         Exit Sub
  210.     End If
  211.     'Show Form
  212.     Me.Show , frmParent
  213.     'Get Disc Information
  214.     SetStatus
  215. End Sub
  216. Private Sub SetStatus()
  217.     'Default these to not enabled
  218.     cmdCloseDisc.Enabled = False
  219.     cmdCloseSession.Enabled = False
  220.     'Reset this flag
  221.     mblnClosing = False
  222.     'Set number of Sessions
  223.     lblValueSessions.Caption = mobjCDR.GetSessionCount()
  224.     'Free Space blocks
  225.     lblValueFreeSpaceBlocks.Caption = mobjCDR.GetDiscFreeSpaceBlocks(wtpData)
  226.     'Set Disc Status label
  227.     Select Case mobjCDR.GetDiscStatus()
  228.         Case dsComplete
  229.             lblValueDiscStatus.Caption = "Disc is Closed"
  230.         Case dsEmpty
  231.             lblValueDiscStatus.Caption = "Empty Disc"
  232.         Case dsIncomplete
  233.             lblValueDiscStatus.Caption = "Disc Open"
  234.         Case dsUnknown
  235.             lblValueDiscStatus.Caption = "Unknown"
  236.     End Select
  237.         
  238.     'Set Disc Type label
  239.     Select Case mobjCDR.GetDiscType()
  240.         Case dtCddaCDRom 'Audio or Mode1 CDRom
  241.             lblValueDiscType.Caption = "CD-DA/CD-ROM"
  242.         Case dtCDI
  243.             lblValueDiscType.Caption = "CDI"
  244.         Case dtCDRomXA
  245.             lblValueDiscType.Caption = "CD-ROM XA"
  246.         Case dtUnknown
  247.             lblValueDiscType.Caption = "Unknown"
  248.     End Select
  249.     'Set Last Session Status
  250.     Select Case mobjCDR.GetLastSessionStatus()
  251.         Case ssEmpty
  252.             lblValueLastSessionStatus.Caption = "Empty Session"
  253.         Case ssIncomplete
  254.             lblValueLastSessionStatus.Caption = "Incomplete Session"
  255.             'Let User Close disc/session
  256.             cmdCloseSession.Enabled = True
  257.             cmdCloseDisc.Enabled = True
  258.         Case ssComplete
  259.             lblValueLastSessionStatus.Caption = "Closed Session"
  260.         Case ssReserved
  261.             lblValueLastSessionStatus.Caption = "Unknown"
  262.     End Select
  263. End Sub
  264. Private Sub mobjCDR_ClosingSession()
  265.     lblStatus.Caption = "...Closing Session/Disc..."
  266. End Sub
  267. Private Sub mobjCDR_WriteError(ByVal WriteError As CDWriterXPLib.eWriteError, ByVal DeviceError As CDWriterXPLib.eCDError)
  268.     'Show msg to user
  269.     MsgBox "Error closing Session/Disc #" & DeviceError, vbCritical, App.Title
  270.     mblnClosing = False
  271.     Unload Me
  272. End Sub
  273. Private Sub mobjCDR_WritingComplete()
  274.     'Close is complete
  275.     lblStatus.Caption = "Closing Successful!!"
  276.     SetStatus
  277.     MsgBox "Session/Disc Closed Successful!", vbInformation + vbOKOnly, App.Title
  278.     mblnClosing = False
  279.     cmdOK.Enabled = True
  280. End Sub
  281.